Skip to content

Introduction to Node-RED ​

Node-RED is the flow editor that runs on every Rosepetal controller. It connects cameras, image processing, AI models and outputs by wiring nodes together. In this guide you open it from the platform, find your way around the editor, and build, deploy and test a first flow.

What you will learn

  • Where Node-RED lives in the platform and what its editor shows
  • Which nodes Rosepetal adds for cameras, images and AI models
  • How to add, wire and deploy nodes
  • How to read a message in the debug panel and change it with a function node

Before you start

You need a controller that shows as online in the platform and a user who can open «Flows». The flow you build here lives in its own tab and does not touch the flows already running on the controller.

1. Open Node-RED from the platform ​

Click «Flows» in the top bar. The platform opens the Node-RED editor of the controller selected on the right of the bar, so you always edit the flows of one machine. If you have several controllers, choose the one you want there first.

Open Node-RED from the platform

2. Read a flow ​

Each tab of the editor holds one flow. A node does one job, such as capturing an image, running a model or showing a result, and passes a message to the next node through a wire. The tabs you see when the editor opens are the flows running on the controller.

Read a flow

3. Find the nodes in the palette ​

The palette, on the left, groups the nodes by category. «common» and «function» hold the standard Node-RED nodes that every flow uses. Type in «filter nodes» to find a node by name.

Find the nodes in the palette

4. Meet the Rosepetal nodes ​

Further down the palette are the nodes Rosepetal adds to Node-RED:

  • Cameras. One category per camera family, such as «RP Basler», «RP Irayple» or «RP Omron», each with a collector, a trigger and a configuration node.
  • «RP Image». Nodes that read, crop, resize, rotate and draw on images.
  • «Rosepetal». Nodes that connect the flow to your platform project: dataset-upload and from-dataset for datasets, inferencer and ocr to run your models.
  • «RP Utils». Helpers such as queues, rate limits and the barcode reader.

Meet the Rosepetal nodes

5. Create a flow of your own ​

Click «+» at the end of the tab bar to add a flow, then double-click the new tab to name it. One flow per task keeps a controller easy to read, and a new tab leaves the running flows untouched.

6. Add an inject node ​

Drag «inject» from the palette and drop it on the workspace. An inject node starts a flow by sending a message, when you press its button or on a schedule. Dropped as it is, it sends the current time.

7. Add a debug node ​

Drop a «debug» node to the right of the first one. A debug node prints every message it receives in the debug panel, which makes it the quickest way to see what a flow is doing.

Add a debug node

8. Wire the nodes ​

Nodes have an input port on the left and output ports on the right. Press on the output port of the inject node, drag to the input port of the debug node and release. The wire is the path the message will follow.

Wire the nodes

9. Deploy the flow ​

The blue dots on the nodes and the red «Deploy» button mean the editor has changes the controller does not know about. Click «Deploy» to send them. From the arrow next to the button you can choose «Modified Flows», which deploys only what changed and leaves the other flows running.

Deploy the flow

10. Send a message ​

The flow is now running on the controller. Press the square button on the left of the inject node to make it send a message.

11. Read the message ​

The «Debug messages» panel, on the right, shows the message the debug node received. Every message is an object called msg, and its main content travels in msg.payload. Here the payload is the time the inject node sent, as a number.

Read the message

12. Change the message with a function node ​

Drag a «function» node from the palette and hold it over the wire until the wire turns dashed, then drop it. Node-RED places it between the two nodes and rewires the flow for you.

Change the message with a function node

13. Write the function ​

Double-click the function node to open its editor. The code in «On Message» runs for every message that arrives. Add this line above return msg; to replace the payload:

js
msg.payload = "Hello Rosepetal!";

Write the function

14. Deploy and test again ​

Click «Done» to close the editor, «Deploy» to send the change to the controller, and the button of the inject node to run the flow again.

15. Check the result ​

The new message in the debug panel carries the text you wrote. The inject node sent a timestamp, the function node replaced it, and the debug node showed the result: the same pattern every flow on the controller follows, with cameras and models in place of these three nodes.

Check the result

The ideas to keep ​

IdeaWhat it means
NodeOne step of a flow: it receives a message, does one job and passes the message on.
WireThe path a message follows from the output of one node to the input of the next.
MessageThe object that travels through the flow. Its main content is in msg.payload.
DeploySends the flows in the editor to the controller. Nothing runs until you deploy.
Debug panelShows the messages that reach a debug node. Use it to see what a flow is doing.

Next steps ​

Recorded on Rosepetal release 1.8.15, Node-RED 5.0.10.